package com.example.mobile2021606127cxz0427;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Context;
import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private RecyclerView recyclerView;
    private List<Items> list = new ArrayList<>();


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        recyclerView = findViewById(R.id.rv);

        list.add(new Items(R.drawable.parkinglot1,"兴华商场停车场","空位：30","价格：5元/小时","距离：20公里","地址：祖庙路48号附近","更多信息"));
        list.add(new Items(R.drawable.parkinglot2,"良缘路停车场","空位：30","价格：5元/小时","距离：20公里","地址：祖庙良缘路马哥孛罗酒店岭南天地南","更多信息"));
        list.add(new Items(R.drawable.parkinglot3,"佛山植物园停车场","空位：30","价格：5元/小时","距离：20公里","地址：兴业西路17号","更多信息"));
        list.add(new Items(R.drawable.parkinglot4,"南海观音寺停车场","空位：30","价格：5元/小时","距离：20公里","地址：佛山市南海区南国桃园旅游度假区内","更多信息"));
        list.add(new Items(R.drawable.parkinglot5,"大塘服务区停车场","空位：30","价格：5元/小时","距离：20公里","地址：G94珠三角环线高速附近","更多信息"));

        LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this);
        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.VERTICAL));
        ItemsAdapter adapter=new ItemsAdapter(list);
        recyclerView.setAdapter(adapter);

    }
}